package com.hhd.flow.controller;

import com.hhd.flow.vo.CountUserSignVo;
import com.hhd.flow.vo.Result;
import com.hhd.flow.engine.FlowEngine;
import com.hhd.flow.engine.cmd.impl.CountUserSignCommand;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

@RestController
@RequestMapping("/flow")
public class CountUserSignController {
    @Autowired
    FlowEngine flowEngine;

    @PostMapping("/countUserSign")
    public Result countUserSign(@RequestBody CountUserSignVo countUserSign) {
        CountUserSignCommand command = flowEngine.newCountUserSignCommandBuilder()
                .userTask(countUserSign.getUserTask())
                .flowUserTaskId(countUserSign.getFlowUserTaskId())
                .build();
        flowEngine.execute(command);
        return Result.ok();
    }
}
